# while 效果一：
i = 1
while i <= 9:
    j = 1
    while j <= i:
        print ('{}*{}={:<4}'.format(j,i,i*j),end='')
        j = j+1
    i = i+1
    print()
print('='*80)

i = 9
while i >= 1:
    j = 1
    while j <= i:
        print ('{}*{}={:<4}'.format(j,i,i*j),end='')
        j = j+1
    i = i-1
    print()
print('#'*100)

# while 效果二：
i = 1
while i<= 9:
    j=8
    while j>=i:
        print('{:<8}'.format(''),end='')
        j=j-1
    k=i
    while k>=1:
        print('{}*{}={:<4}'.format(k,i,i*k),end='')
        k=k-1
    i=i+1
    print()
print('='*80)
i = 9
while i>= 1:
    j=8
    while j>=i:
        print('{:<8}'.format(''),end='')
        j=j-1
    k=i
    while k>=1:
        print('{}*{}={:<4}'.format(k,i,i*k),end='')
        k=k-1
    i=i-1
    print()
print('#'*100)

# for 循环 效果一
for i in range (1,10):
    for j in range (1,i+1):
        print('{}*{}={:<4}'.format(j, i, i * j), end='')
    print()
print('='*80)
for i in range (9,0,-1):
    for j in range (1,i+1):
         print('{}*{}={:<4}'.format(j,i, i * j), end='')
    print()
print('#'*100)

# for 循环 效果二
for i in range(1,10):
        for j in range(9,0,-1):
            if j <= i:
                print("{}*{}={:<4}".format(j,i,i*j),end=" ")
            else:
                print("{:<8}".format(" "),end=" ")
        print("")
print('='*80)
for i in range(9,0,-1):
        for j in range(9,0,-1):
            if i>=j:
                print("{}*{}={:<4}".format(i,j,i*j),end=" ")
            else:
                print("{:<8}".format(" "),end=" ")
        print("")


